﻿<?
$ids='';
if(isset($_REQUEST['ids'])) $ids = $_REQUEST['ids'];
//if($ids==='') header("Location: index.php");
session_id($ids);
//session_start();
if($_SESSION) $lngs=$_SESSION['lng'];
 
class yellowpages{
 function yellowpages(){
  /*mysql_connect("localhost","root") or die("could not connection");
  mysql_select_db("yellowpages");
  mysql_connect("localhost","ypvnjsc_ypvn","yp2006") or die("could not connection");
  mysql_select_db("ypvnjsc_yellowpages");*/
  mysql_connect("localhost","ypvnvn_ypvn","yp2006") or die("could not connection");
  mysql_select_db("ypvnvn_yellowpages");
 }
 
 function changeLang(){
  $a = func_get_args();
  $p=pathinfo($_SERVER['PHP_SELF']);
  $nm=basename($p['basename'],".".$p['extension']);
  switch($a[2]){
   case 'us':
    $lnk	= $nm."vn";
	$lnks	= $nm."cn";
    break;
   case 'vn':
    $nm		= substr($nm,0,strlen($nm)-2);
    $lnk	= $nm;
	$lnks	= $nm."cn";
	break;
   case 'cn':
    $nm		= substr($nm,0,strlen($nm)-2);
    $lnk	= $nm;
	$lnks	= $nm."vn";
	break;
  }
  $q='';
  if(isset($_SERVER['QUERY_STRING'])) $q=$_SERVER['QUERY_STRING'];
  $t = "<a class=style6 href=$lnk.php?$q>$a[0]</a> | 
  		<a class=style6 href=$lnks.php?$q>$a[1]</a>";
  return $t;
 }
 
 function leftMenu(){
 $a = func_get_args();
 if($a[3] == 'cn')
 $t="<table class=tab cellpadding=0 cellspacing=0 width=160>
  	 <tr><td height='23' colspan='2' bgcolor='#1B90D5' class='style4' style='padding-left:10px' ><b>热门搜索</b></td></tr>"
	 .$this->makeCell($a[0],'')."<tr class=bgw><td class='sz3 bdblmn bdllmn bdrlmn' colspan=2>
	 &nbsp;</td></tr><tr><td colspan=2 height=10></td></tr>
	 <tr><td height='23' colspan='2' bgcolor='#1B90D5' class='style4' style='padding-left:10px' ><b>其他搜索</b></td></tr>
	 <tr class=bgw><td class='sz3 bdtlmn bdllmn bdrlmn' colspan=2>&nbsp;</td></tr>"
	 .$this->makeCell($a[1],'')."<tr class=bgw><td class='sz3 bdblmn bdllmn bdrlmn' colspan=2>
	 &nbsp;</td></tr><tr><td colspan=2 height=10></td></tr>
	 <tr><td height='23' colspan='2' bgcolor='#1B90D5' class='style4' style='padding-left:10px' ><b>商务解决</b></td></td></tr>
	 <tr class=bgw><td class='sz3 bdtlmn bdllmn bdrlmn' colspan=2>&nbsp;</td></tr>"
	 .$this->makeCell($a[2],'target=_blank')."<tr class=bgw>
	 <td class='sz3 bdblmn bdllmn bdrlmn' colspan=2>&nbsp;</td></tr>
	 <tr><td colspan=2 height=10></td></tr>";
	elseif($a[3] == 'vn')
	$t="<table class=tab cellpadding=0 cellspacing=0 width=160>
  	 <tr><td height='23' colspan='2' bgcolor='#1B90D5' class='style4' style='padding-left:10px' ><b>Thông tin hữu dụng</b></td></tr>"
	 .$this->makeCell($a[0],'')."<tr class=bgw><td class='sz3 bdblmn bdllmn bdrlmn' colspan=2>
	 &nbsp;</td></tr><tr><td colspan=2 height=10></td></tr>
	 <tr><td height='23' colspan='2' bgcolor='#1B90D5' class='style4' style='padding-left:10px' ><b>Thông tin khác</b></td></tr>
	 <tr class=bgw><td class='sz3 bdtlmn bdllmn bdrlmn' colspan=2>&nbsp;</td></tr>"
	 .$this->makeCell($a[1],'')."<tr class=bgw><td class='sz3 bdblmn bdllmn bdrlmn' colspan=2>
	 &nbsp;</td></tr><tr><td colspan=2 height=10></td></tr>
	 <tr><td height='23' colspan='2' bgcolor='#1B90D5' class='style4' style='padding-left:10px' ><b>Phần chuyên mục</b></td></td></tr>
	 <tr class=bgw><td class='sz3 bdtlmn bdllmn bdrlmn' colspan=2>&nbsp;</td></tr>"
	 .$this->makeCell($a[2],'target=_blank')."<tr class=bgw>
	 <td class='sz3 bdblmn bdllmn bdrlmn' colspan=2>&nbsp;</td></tr>
	 <tr><td colspan=2 height=10></td></tr>";
	else
	$t="<table class=tab cellpadding=0 cellspacing=0 width=160>
  	 <tr><td height='23' colspan='2' bgcolor='#1B90D5' class='style4' style='padding-left:10px' ><b>Popular Searches</b></td></tr>"
	 .$this->makeCell($a[0],'')."<tr class=bgw><td class='sz3 bdblmn bdllmn bdrlmn' colspan=2>
	 &nbsp;</td></tr><tr><td colspan=2 height=10></td></tr>
	 <tr><td height='23' colspan='2' bgcolor='#1B90D5' class='style4' style='padding-left:10px' ><b>Others Search</b></td></tr>
	 <tr class=bgw><td class='sz3 bdtlmn bdllmn bdrlmn' colspan=2>&nbsp;</td></tr>"
	 .$this->makeCell($a[1],'')."<tr class=bgw><td class='sz3 bdblmn bdllmn bdrlmn' colspan=2>
	 &nbsp;</td></tr><tr><td colspan=2 height=10></td></tr>
	 <tr><td height='23' colspan='2' bgcolor='#1B90D5' class='style4' style='padding-left:10px' ><b>Bussinesss Solution</b></td></td></tr>
	 <tr class=bgw><td class='sz3 bdtlmn bdllmn bdrlmn' colspan=2>&nbsp;</td></tr>"
	 .$this->makeCell($a[2],'target=_blank')."<tr class=bgw>
	 <td class='sz3 bdblmn bdllmn bdrlmn' colspan=2>&nbsp;</td></tr>
	 <tr><td colspan=2 height=10></td></tr>";
   	return "$t</table>";
 }
 
 function menuLeft(){
  $a = func_get_args(); $t='';
  if($a[2])
   $t="<tr><td></td></tr>";
  else{
   if($_SESSION['istype']=='productList'){
    for($i=0;$i<$a[3];$i++){  $t .= "<tr><td id=ts".($i+1)." class=pdt10 align=center>&nbsp;</td><tr>";}
   }
  } 
  if($a[0]){
   if($a[1]!='') $a[1] = "<tr><td height=10></td></tr>
   <tr><td height=5></td></tr>
   <tr><td height=22 valign=top><table width=200 class=bor>$a[1]<tr><td height=10></td></tr></table></td></tr>";
   
   $t ="<tr><td align=center height=22 valign=top><table width=200 class=bor>$a[0]</table></td></tr>
   	 <tr><td height=24 align=center bgcolor=#cccccc><img id=imgdown onMouseOver=\"upAndDown('ismenu','down','imgup','imgdown')\" onMouseOut=\"upAndDown('ismenu','out')\" class=hand hspace=5 src=images/bt_downdis.gif><img id=imgup class=hand onMouseOver=\"upAndDown('ismenu','up','imgdown','imgup')\" onMouseOut=\"upAndDown('ismenu','out')\" src=images/bt_up.gif></td></tr>$a[1]<tr><td height=10></td></tr><tr><td height=22 valign=top><table class=bor1 width=200>$t</table></td></tr>";
  }elseif($a[1])
  $t ="<tr><td height=22 valign=top><table width=200 class=bor1>$a[1]<tr><td height=10></td></tr></table>
	 </td></tr><tr><td height=5></td></tr><tr><td height=10></td></tr><tr><td height=22 valign=top><table class=bor1 width=200>$t</table></td></tr>";
 
  return $t;
 }
 
 function makeCell(){
  $a = func_get_args();
  $t='';
  for($i=0;$i<count($a[0]);$i++){
   $t.="<tr class=bgw><td class='pdlr2 bdllmn' align=center height=20><img src=images/bullet.gif></td>
   <td class=bdrlmn><a class=lfMenu href='".$a[0][$i][1]."' titile='".$a[0][$i][0]."' $a[1]>".$a[0][$i][0]."</a></td></tr>";
  }
  return $t;
 }
 
 function isCheck($a,$b){
   if($a==$b) return 'selected';
 }
 
 function setIndex($p){
  return array_keys($p);
 }
 
 function checkVn($t){
  $v = array('Á','À','Ả','Ã','Ạ','Ă','Â','Ấ','Ầ','Ẩ','Ẫ','Ậ','Ắ','Ằ','Ẳ','Ẵ','Ặ','É','È','Ẻ','Ẽ',
    'Ẹ','Ê','Ế','Ề','Ể','Ễ','Ệ','Í','Ì','Ỉ','Ĩ','Ị','Đ','Ó','Ò','Ỏ','Õ','Ọ','Ơ','Ô','Ố','Ồ','Ổ',
	'Ỗ','Ộ','Ớ','Ờ','Ở','Ỡ','Ợ','Ú','Ù','Ủ','Ũ','Ụ','Ư','Ứ','Ừ','Ử','Ữ','Ự','Ý','Ỳ','Ỷ','Ỹ','Ỵ',
	'á','à','ả','ã','ạ','â','ấ','ầ','ẩ','ẫ','ậ','ă','ắ','ằ','ẳ','ẵ','ặ','é','è','ẻ','ẽ','ẹ','ê',
	'ế','ề','ể','ễ','ệ','í','ì','ỉ','ĩ','ị','đ','ó','ò','ỏ','õ','ọ','ô','ố','ồ','ổ','ỗ','ộ','ơ',
	'ớ','ờ','ở','ỡ','ợ','ú','ù','ủ','ũ','ụ','ư','ứ','ừ','ử','ữ','ự','ý','ỳ','ỷ','ỹ','ỵ');
  for($i=0;$i<count($v);$i++)
   if(strpos($t,$v[$i])!==FALSE) return '';
  return '_no';
 }
}//end class
?>